import { Component, OnInit, Input, ViewChild } from '@angular/core';
import { SFSchema, SFComponent } from '@delon/form';
import { HttpService } from 'lbf';
import { NzMessageService } from 'ng-zorro-antd';

@Component({
  selector: 'show-form',
  templateUrl: './show_form.component.html'
})
export class ShowFormComponent implements OnInit {
  @Input() dataDAD069 = 0;
  @Input() dataSpan = 8;
  @Input() dataDAD017 = 0;
  @ViewChild('addForm',{static:false}) addForm: SFComponent;
  addSchema:SFSchema = {

    properties:{
      DAD069:{
        type: 'string',
        title: '事项主键',
        ui:
        {
          hidden: true
        }      
      }
    }
  };
  get value(): any {
    return this.addForm.value;
  }

  get vaild(){
     return this.addForm.valid;
  }

  ngOnInit() {
    this.initForm();
  }

  initForm(){
    this.lbs.lbservice("SHOWFORM_INIT",{ DAD069: this.dataDAD069, SPAN: this.dataSpan, DAD017: this.dataDAD017 }).then(resdata=>{
      if(resdata.code<1)
      {
         this.msgSrv.error(resdata.errmsg);
      }
      else
      {
        this.addSchema = resdata;
        // console.log(this.formData);
      }
   });
  }
  constructor(private lbs:HttpService ,public msgSrv: NzMessageService ) { }
}
